//
//	ZcoModelCustomer.m
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "ZcoModelCustomer.h"

NSString *const kZcoModelCustomerAvatar = @"avatar";
NSString *const kZcoModelCustomerCustomerLevel = @"customerLevel";
NSString *const kZcoModelCustomerFullName = @"fullName";
NSString *const kZcoModelCustomerGender = @"gender";
NSString *const kZcoModelCustomerIdField = @"id";
NSString *const kZcoModelCustomerOrg = @"org";
NSString *const kZcoModelCustomerRole = @"role";
NSString *const kZcoModelCustomerUserName = @"userName";

@interface ZcoModelCustomer ()
@end
@implementation ZcoModelCustomer




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kZcoModelCustomerAvatar] isKindOfClass:[NSNull class]]){
		self.avatar = dictionary[kZcoModelCustomerAvatar];
	}	
	if(![dictionary[kZcoModelCustomerCustomerLevel] isKindOfClass:[NSNull class]]){
		self.customerLevel = [dictionary[kZcoModelCustomerCustomerLevel] integerValue];
	}

	if(![dictionary[kZcoModelCustomerFullName] isKindOfClass:[NSNull class]]){
		self.fullName = dictionary[kZcoModelCustomerFullName];
	}	
	if(![dictionary[kZcoModelCustomerGender] isKindOfClass:[NSNull class]]){
		self.gender = dictionary[kZcoModelCustomerGender];
	}	
	if(![dictionary[kZcoModelCustomerIdField] isKindOfClass:[NSNull class]]){
		self.idField = [dictionary[kZcoModelCustomerIdField] integerValue];
	}

	if(![dictionary[kZcoModelCustomerOrg] isKindOfClass:[NSNull class]]){
		self.org = dictionary[kZcoModelCustomerOrg];
	}	
	if(![dictionary[kZcoModelCustomerRole] isKindOfClass:[NSNull class]]){
		self.role = dictionary[kZcoModelCustomerRole];
	}	
	if(![dictionary[kZcoModelCustomerUserName] isKindOfClass:[NSNull class]]){
		self.userName = dictionary[kZcoModelCustomerUserName];
	}	
	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.avatar != nil){
		dictionary[kZcoModelCustomerAvatar] = self.avatar;
	}
	dictionary[kZcoModelCustomerCustomerLevel] = @(self.customerLevel);
	if(self.fullName != nil){
		dictionary[kZcoModelCustomerFullName] = self.fullName;
	}
	if(self.gender != nil){
		dictionary[kZcoModelCustomerGender] = self.gender;
	}
	dictionary[kZcoModelCustomerIdField] = @(self.idField);
	if(self.org != nil){
		dictionary[kZcoModelCustomerOrg] = self.org;
	}
	if(self.role != nil){
		dictionary[kZcoModelCustomerRole] = self.role;
	}
	if(self.userName != nil){
		dictionary[kZcoModelCustomerUserName] = self.userName;
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.avatar != nil){
		[aCoder encodeObject:self.avatar forKey:kZcoModelCustomerAvatar];
	}
	[aCoder encodeObject:@(self.customerLevel) forKey:kZcoModelCustomerCustomerLevel];	if(self.fullName != nil){
		[aCoder encodeObject:self.fullName forKey:kZcoModelCustomerFullName];
	}
	if(self.gender != nil){
		[aCoder encodeObject:self.gender forKey:kZcoModelCustomerGender];
	}
	[aCoder encodeObject:@(self.idField) forKey:kZcoModelCustomerIdField];	if(self.org != nil){
		[aCoder encodeObject:self.org forKey:kZcoModelCustomerOrg];
	}
	if(self.role != nil){
		[aCoder encodeObject:self.role forKey:kZcoModelCustomerRole];
	}
	if(self.userName != nil){
		[aCoder encodeObject:self.userName forKey:kZcoModelCustomerUserName];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.avatar = [aDecoder decodeObjectForKey:kZcoModelCustomerAvatar];
	self.customerLevel = [[aDecoder decodeObjectForKey:kZcoModelCustomerCustomerLevel] integerValue];
	self.fullName = [aDecoder decodeObjectForKey:kZcoModelCustomerFullName];
	self.gender = [aDecoder decodeObjectForKey:kZcoModelCustomerGender];
	self.idField = [[aDecoder decodeObjectForKey:kZcoModelCustomerIdField] integerValue];
	self.org = [aDecoder decodeObjectForKey:kZcoModelCustomerOrg];
	self.role = [aDecoder decodeObjectForKey:kZcoModelCustomerRole];
	self.userName = [aDecoder decodeObjectForKey:kZcoModelCustomerUserName];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	ZcoModelCustomer *copy = [ZcoModelCustomer new];

	copy.avatar = [self.avatar copy];
	copy.customerLevel = self.customerLevel;
	copy.fullName = [self.fullName copy];
	copy.gender = [self.gender copy];
	copy.idField = self.idField;
	copy.org = [self.org copy];
	copy.role = [self.role copy];
	copy.userName = [self.userName copy];

	return copy;
}
@end